package com.dong.classovertest;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBUtil {
    private static String driver;
    private static String url;
    private static String user;
    private static String pwd;


    static {
        try {
            driver="com.mysql.cj.jdbc.Driver";
            url="jdbc:mysql://localhost:3307/video1?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai";
            user="root";
            pwd="1234";
            Class.forName(driver);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

    }
    public static Connection getConnection() throws SQLException {
        return DriverManager.getConnection(url,user,pwd);
    }
}
